package cn.dengta.webapp.trade.entity;

import java.math.BigDecimal;

import cn.dengta.common.model.ValueProxy;
import cn.dengta.common.model.ValueProxyImpl;
import cn.dengta.webapp.base.entity.BizEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;

/**
 * 提现金额配置
 *
 * @author hsj
 * @since 2024-02-23
 */
@Setter
@Getter
@TableName("dt_cash_amount_config")
public class CashAmountConfig extends BizEntity {

	/** 积分 */
	BigDecimal integral;
	/** 提现金额 */
	BigDecimal amount;
	/** 提现次数 */
	Integer cashCount;
	/** 0:非实时到账 1: 实时到账 */
	Integer realTime;
	/** 0:提现 1:首次提现 */
	Integer type;

	transient Type typeEnum;

	/** 是否秒到账 */
	public Boolean isRealTimeTransfer() {
		return getRealTime() == 1;
	}

	public Type getTypeEnum() {
		return Type.of(type);
	}

	public String getType_() {
		return getTypeEnum().getLabel();
	}

	public String getRealTime_() {
		return isRealTimeTransfer() ? "实时到账" : "3天内";
	}

	public enum Type implements ValueProxyImpl<Type, Integer> {
		COMMON(0, "提现"),
		FIRST_CASH(1, "首次提现"),
		;

		final ValueProxy<Type, Integer> proxy;

		Type(Integer value, String label) {
			proxy = new ValueProxy<>(this, value, label);
		}

		@Override
		public ValueProxy<Type, Integer> getProxy() {
			return proxy;
		}

		public static Type of(Integer value) {
			return COMMON.getValueOf(value);
		}

	}

	public static final String COIN = "coin";
	public static final String INTEGRAL = "integral";
	public static final String AMOUNT = "amount";
	public static final String CASH_COUNT = "cash_count";
	public static final String TYPE = "type";

}
